using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class PrescriptionMap : EntityTypeConfiguration<Prescription>
    {
        public PrescriptionMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.Subject)
                .HasMaxLength(50);

            this.Property(t => t.Cust_id)
                .IsRequired()
                .HasMaxLength(6);

            this.Property(t => t.Phyid)
                .IsRequired()
                .HasMaxLength(6);

            this.Property(t => t.adm_id)
                .HasMaxLength(10);

            // Table & Column Mappings
            this.ToTable("Prescriptions");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Subject).HasColumnName("Subject");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Cust_id).HasColumnName("Cust_id");
            this.Property(t => t.Phyid).HasColumnName("Phyid");
            this.Property(t => t.Dispense).HasColumnName("Dispense");
            this.Property(t => t.adm_id).HasColumnName("adm_id");
        }
    }
}
